import React from 'react';
import {inject, observer} from 'mobx-react';
import {Browser,BrowserHrm,BrowserHrmCondition } from 'weaver-mobile-page';
import {withRouter} from 'react-router-dom';
import {Tools, Button, Icon,Avatar} from 'weaver-mobile';
const getLabel = Tools.getLabel;
@inject ('planViewStore')
@withRouter
@observer
class ReportShare extends React.Component {
  constructor (props) {
    super (props);
    this.state = {};
    this.store = this.props.planViewStore;
  }

  componentWillMount () {
    this.store.getShare()
  }
  render () {
    const prefixClass = 'workrelate-mobile-plan-planview-share-';
    let {browserShare,browserShareValue,setState,canshare,shareStore,shareStoreValue} = this.store;
    const { history } = this.props;
    return (
      <div className={`${prefixClass}container`}>
          {/* {canshare &&<Button  onClick={() => history.push(browserShare.path)}>+ {getLabel(18645,'添加共享')}</Button>} */}
          <div>
            <BrowserHrmCondition
              label={getLabel(19303, '人力资源条件')}
              isSingle={false}
              store={shareStore}
              onChange={(...arg) => {
                console.log(arg[2])
                setState({ shareStoreValue: arg[2] });
                this.store.setShare()
              }}
              valueArray={shareStoreValue}
            />
          </div>

          {/* <div>
            <BrowserHrm
                label={getLabel(513711,'共享人')}
                viewAttr={canshare?2:1}
                store={browserShare}
                hasAdvanceSerach
                isSingle={false}
                type={1}
                onChange={(value, valueSpan, valueArray) => {
                   setState({ shareids: value });
                   setState({ browserShareValue: valueArray });
                   this.store.setPlanShare()
                }}
                valueArray={browserShareValue}
                placeholder={canshare ? getLabel(18214, '请选择') : ''}
                disabled={!canshare}
            />
          </div> */}
      </div>
    );
  }
}

export default ReportShare;
